package sample.testTickManager
{
	import flash.display.Sprite;
	import flash.events.Event;

	import org.abc.interfaces.ITick;
	import org.abc.interfaces.ITickManager;
	import org.abc.manager.TimerTickManager;

	/**
	 * ...
	 * @author Mr.zheng
	 */
	public class TestTickManager extends Sprite
	{

		public function TestTickManager():void
		{
			if (stage)
				init();
			else
				addEventListener(Event.ADDED_TO_STAGE, init);
		}

		private function init(e:Event=null):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point

			var ball:Ball;
			var tickManager:ITickManager=TimerTickManager.instance;
			tickManager.init(this.stage);
			for (var i:int=0; i < 1000; i++)
			{
				ball=new Ball();
				addChild(ball);
				ball.x=Math.random() * stage.stageWidth;
				ball.y=Math.random() * stage.stageHeight;
				tickManager.addTick(ball);
			}

			var tickMouse:ITick=new TickMouseEvent(this.stage);
			tickManager.addTick(tickMouse);

		/*var btn:AbcDynamicBtn = new AbcDynamicBtn(new NormalBtn);
		btn.label = "按钮";
		addChild(btn);*/
		}

	}

}
